package com.example.lvsuo.controller;


import com.example.lvsuo.entity.HrDegree;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.IHrDegreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/hrDegree")
public class HrDegreeController {

    @Autowired
    IHrDegreeService iHrDegreeService;

    /**
     * 根据律师表id查询教育经历
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result getHrDegree(@PathVariable String id){
        List<HrDegree> hrDegree = iHrDegreeService.getHrDegree(id);
        return Result.back("ok","20000",hrDegree) ;
    }

    /**
     * 根据id添加教育经历
     * @param hrDegree
     * @param id
     */
    @PostMapping("/{id}")
    public void insertHrDegree(@RequestBody HrDegree hrDegree,@PathVariable Long id){
        hrDegree.setHrEmpId(id);
        iHrDegreeService.insertHrDegree(hrDegree);
    }

}

